
#include <ChangeArea.h>
#include <World.h>
#include <Area.h>
#include <Camera.h>

ChangeArea::ChangeArea(World* worldptr, Area* newArea)
:Command(CommandType::BLOCKING)
,world(worldptr)
,area(newArea)
{
}

ChangeArea::~ChangeArea() 
{}

truth ChangeArea::Execute()
{
	if(area)
	{
		if(world->GetCurrentArea())
		{
			world->UnloadCurrentArea();
		}

		world->SetArea(area);
		world->InitCurrentArea();
		Global::SetDebugMode(0);
		complete = 1;
		return complete;
	}
	return 1;
}